fix: prevent flickering in 3-way conflict diff (#317)#320
Merged
esmuellert merged 1 commit intomainfrom Mar 11, 2026
Merged
Conversation
The same-file deduplication check in on_file_select failed for conflict files because revisions :2/:3 match the mutable pattern ^:[0-3]$, but conflict files are not in the staged list. This caused every git-watcher refresh (~500ms) to re-trigger view.update() → setup_conflict_result_window(), producing constant flickering, cursor trapping, and forced tab switching. Add conflict-specific early return: when group is 'conflicts' and session already has a valid result_win, skip the update. Also fix variable shadowing in auto_refresh.lua where tabpage was re-declared with get_current_tabpage() inside vim.schedule, instead of using the correct tabpage from find_tabpage_by_buffer(). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #317 — constant flickering, cursor trapping, and forced tab switching in 3-way merge conflict mode.
Root Cause
The same-file deduplication check in
on_file_select(render.lua) failed for conflict files. Conflict revisions:2/:3match the mutable pattern^:[0-3]$, but conflict files are not in thestagedlist. This caused:file_has_staged ~= current_is_mutable→false ~= true→ always falls throughview.update()→setup_conflict_result_window()Same class of bug as the staged rename flicker fix (2a8a1f1) — deduplication failure causing repeated view rebuilds — but for conflict mode specifically.
Changes
fix(render): conflict file deduplication
Add conflict-specific early return in
on_file_select: whengroup == "conflicts"and session already has a validresult_win, skip the update.fix(auto_refresh): variable shadowing
Remove re-declarations of
lifecycleandtabpageinsidevim.schedulethat shadowed the outer closure withget_current_tabpage(). Now consistently uses the correct tabpage fromfind_tabpage_by_buffer().Testing
tests/ui/conflict/conflict_dedup_spec.lua(4 tests)